package com.example.blog_system_ssm.common;

import com.example.blog_system_ssm.model.UserInfo;

//保存用户信息到ThreadLocal
public class UserThreadLocal {

    private UserThreadLocal(){}

    private static final ThreadLocal<UserInfo> LOCAL=new ThreadLocal<>();

    public static void put(UserInfo userInfo){
        LOCAL.set(userInfo);
    }

    public static UserInfo get(){
        return LOCAL.get();
    }

    public static void remove(){
        LOCAL.remove();
    }
}
